<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>页面相关</title>
</head>
<body>
    <div id="mydiv">我是div</div>
    <input type="text" id="myinput">
    <input type="button" value="按钮" onclick="fn()">

    <script>
        function fn(){
            //得到文本框和div
            let i = document.getElementById("myinput")
            let d = document.getElementById("mydiv")
            //把文本框的值取出给到div
            d.innerText = i.value;
        }


    </script>


</body>
</html>